﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GraphGeneric
{
    /// <summary>
    /// A generic graph interface
    /// </summary>
    /// <typeparam name="V">The type that goes in a node</typeparam>
    /// <typeparam name="W">The type of the edge weight </typeparam>
    public interface IGraph<V, W> where W : IComparable<W>
    {
        IEnumerable<INode<V, W>> AllNodes { get; }
        //IEnumerable<IEdge<V, W>> AllEdges { get; }
        INode<V, W> GetNode(V value);

        INode<V, W> AddNode(V value);

        IEdge<V, W> AddEdge(V fromValue, V toValue);
        IEdge<V, W> AddEdge(INode<V, W> fromNode, INode<V, W> toNode);

    }

    public interface INode<V, W> where W : IComparable<W>
    {
        V Value { get; }
        IEnumerable<IEdge<V, W>> Edges { get; }
        void AddEdge(IEdge<V, W> edge);
    }

    public interface IEdge<V, W> where W : IComparable<W>
    {
        INode<V, W> FromNode { get; }
        INode<V, W> ToNode { get; }
        W Weight { get; }
        bool IsDirected { get; }
    }
}
